package com.kangyi.app.mapper;

import com.github.pagehelper.Page;
import com.kangyi.app.annotation.AutoFill;
import com.kangyi.dto.NursingHomeAppointmentsDTO;
import com.kangyi.entity.NursingHomeBooking;
import com.kangyi.enumeration.OperationType;
import com.kangyi.vo.NursingHomeAppointmentsVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author Blank
 * @version 1.0
 */
@Mapper
public interface NursingHomeBookingMapper {

    @Select("select * from nursing_home_booking where user_id = #{userId} and nursing_home_id = #{nursingHomeId};")
    NursingHomeBooking selectByUserIdAndNursingHomeId(Integer userId, Integer nursingHomeId);

    @Insert("insert into nursing_home_booking(user_id, nursing_home_id, name, phone, number, notes, booking_time, reason, create_user, update_user, create_time, update_time) " +
            "values (#{userId},#{nursingHomeId},#{name},#{phone},#{number},#{notes},#{bookingTime},#{reason},#{createUser},#{updateUser},#{createTime},#{updateTime})")
    @AutoFill(value = OperationType.INSERT)
    void addNursingHomeBooking(NursingHomeBooking nursingHomeBooking);

    Page<NursingHomeAppointmentsVO> list(NursingHomeAppointmentsDTO nursingHomeAppointmentsDTO);
}
